smp-server: add serverInfoBytes to THandleParams and related functions#1825
smp-server: add serverInfoBytes to THandleParams and related functions#1825ed-asriyan wants to merge 1 commit into
Conversation
| serviceAuth :: Bool | ||
| serviceAuth :: Bool, | ||
| -- | JSON-encoded ServerPublicInfo from handshake, present when server version >= serverInfoSMPVersion | ||
| serverInfoBytes :: Maybe ByteString |
There was a problem hiding this comment.
why not include the actual type here, and parse JSON in parser? Or you think there is a value in lenient parser? but then you could just include Nothing if JSON fails to parse, or Either String ServerInfo (it would help to know in test that info was sent but was invalid).
| serverInfoBytes :: Maybe ByteString | |
| serverInfo :: Either String ServerPublicInfo |
There was a problem hiding this comment.
I tried replacing Maybe ByteString with Either String ServerPublicInfo, but putting it into the Transport.hs exports creates a cyclic dependency Simplex.Messaging.Transport -> Simplex.Messaging.Server.Information -> Simplex.Messaging.Agent.Protocol -> Simplex.Messaging.Transport.Client -> Simplex.Messaging.Transport.
I'm not export in Haskell - it's literally the first time for me writing on Haskell :) - but I guess untangling the dependencies may require more refactoring in other modules. Do you think it may worth it?
| authPubKey :: Maybe CertChainPubKey | ||
| authPubKey :: Maybe CertChainPubKey, | ||
| -- | optional server public information (JSON-encoded ServerPublicInfo), sent when version >= serverInfoSMPVersion | ||
| serverInfo :: Maybe ByteString |
There was a problem hiding this comment.
| serverInfo :: Maybe ByteString | |
| serverInfo :: Either String ServerPublicInfo |
No description provided.